package com.alianzamedica.servlets;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alianzamedica.businessobject.Produit;
import com.alianzamedica.models.DrugSelectModel;

/**
 * Servlet implementation class DrugSelectionModelTest
 */
public class DrugSelectionModelTest extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3845567174879570583L;

	@SuppressWarnings("unchecked")
	protected void processRequest(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		DrugSelectModel dm = new DrugSelectModel();
		ArrayList list = dm.getProducts(1);
		int size = list.size();
		for (int i = 0; i < size; i++) {
			Produit produit = (Produit) list.get(i);
			System.out.print("nombre: " + produit.getLargeNomProduit());
			System.out.println(" precio de venta: " + produit.getPrecioVenta());
		}

	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		this.processRequest(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		this.processRequest(request, response);
	}

}
